ga.view.processor
Class OffscreenProcessor

java.lang.Object
  extended by ga.view.processor.OffscreenProcessor
All Implemented Interfaces:
com.jme3.post.SceneProcessor

public class OffscreenProcessor
extends java.lang.Object
implements com.jme3.post.SceneProcessor

Scene processor for offscreen rendering of textures. Allows to render a scene onto a texture.

Since:
12.08.2012
Author:
Stephan Dreyer

Field Summary
private  com.jme3.asset.AssetManager assetManager
           
private  com.jme3.math.ColorRGBA backgroundColor
           
private  com.jme3.font.BitmapText fpsText
           
private  com.jme3.font.BitmapFont guiFont
           
private  com.jme3.scene.Node guiNode
           
private  com.jme3.renderer.ViewPort guiViewPort
           
private static java.util.logging.Logger LOGGER
           
private  com.jme3.material.Material material
           
private  com.jme3.texture.FrameBuffer offscreenBuffer
           
private  com.jme3.renderer.Camera offscreenCam
           
private  com.jme3.scene.Node offscreenScene
           
private  com.jme3.renderer.ViewPort offscreenView
           
private  int renderHeight
           
private  int renderWidth
           
private  com.jme3.renderer.RenderManager rm
           
private  com.jme3.system.AppSettings settings
           
private  java.lang.String text
           
private  com.jme3.texture.Texture2D texture
           
private  java.lang.String textureKey
           
 
Constructor Summary
OffscreenProcessor(com.jme3.asset.AssetManager assetManager, com.jme3.system.AppSettings settings, com.jme3.scene.Node scene, com.jme3.material.Material material, java.lang.String textureKey)
          Creates a new offscreen texture processor with a SimpleTextured material.
 
Method Summary
 void cleanup()
           
 com.jme3.math.ColorRGBA getBackgroundColor()
          Getter for the background color of the scene.
 com.jme3.renderer.Camera getCamera()
          Getter for the camera.
 com.jme3.material.Material getMaterial()
          Getter for the material to render to.
private  void init()
          Pre-initializes the processor.
 void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
           
 boolean isInitialized()
           
 void postFrame(com.jme3.texture.FrameBuffer out)
           
 void postQueue(com.jme3.renderer.queue.RenderQueue rq)
           
 void preFrame(float tpf)
           
 void reshape(com.jme3.renderer.ViewPort vp, int w, int h)
           
 void setBackgroundColor(com.jme3.math.ColorRGBA backgroundColor)
          Setter for the background color of the scene.
 void setText(java.lang.String text)
          Sets a text that is displayed on the GUI.
 void setTextureSize(int width, int height)
          Sets the size of the offscreen texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

renderWidth

private int renderWidth

renderHeight

private int renderHeight

offscreenBuffer

private com.jme3.texture.FrameBuffer offscreenBuffer

offscreenCam

private com.jme3.renderer.Camera offscreenCam

offscreenScene

private final com.jme3.scene.Node offscreenScene

offscreenView

private com.jme3.renderer.ViewPort offscreenView

assetManager

private final com.jme3.asset.AssetManager assetManager

rm

private com.jme3.renderer.RenderManager rm

settings

private final com.jme3.system.AppSettings settings

guiViewPort

private com.jme3.renderer.ViewPort guiViewPort

guiNode

private com.jme3.scene.Node guiNode

fpsText

private com.jme3.font.BitmapText fpsText

guiFont

private com.jme3.font.BitmapFont guiFont

text

private java.lang.String text

backgroundColor

private com.jme3.math.ColorRGBA backgroundColor

texture

private com.jme3.texture.Texture2D texture

material

private final com.jme3.material.Material material

textureKey

private final java.lang.String textureKey
Constructor Detail

OffscreenProcessor

public OffscreenProcessor(com.jme3.asset.AssetManager assetManager,
                          com.jme3.system.AppSettings settings,
                          com.jme3.scene.Node scene,
                          com.jme3.material.Material material,
                          java.lang.String textureKey)
Creates a new offscreen texture processor with a SimpleTextured material.

Parameters:
assetManager - The AssetManager
settings - The application settings
scene - The scene that will be rendered
material - The material to apply the texture to
textureKey - The texture key used to apply the texture
Method Detail

init

private void init()
Pre-initializes the processor.


setTextureSize

public void setTextureSize(int width,
                           int height)
Sets the size of the offscreen texture.

Parameters:
width - With of the texture
height - Height of the texture

initialize

public void initialize(com.jme3.renderer.RenderManager rm,
                       com.jme3.renderer.ViewPort vp)
Specified by:
initialize in interface com.jme3.post.SceneProcessor

setText

public void setText(java.lang.String text)
Sets a text that is displayed on the GUI.

Parameters:
text - GUI text.
Since:
12.08.2012

reshape

public void reshape(com.jme3.renderer.ViewPort vp,
                    int w,
                    int h)
Specified by:
reshape in interface com.jme3.post.SceneProcessor

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface com.jme3.post.SceneProcessor

preFrame

public void preFrame(float tpf)
Specified by:
preFrame in interface com.jme3.post.SceneProcessor

postQueue

public void postQueue(com.jme3.renderer.queue.RenderQueue rq)
Specified by:
postQueue in interface com.jme3.post.SceneProcessor

postFrame

public void postFrame(com.jme3.texture.FrameBuffer out)
Specified by:
postFrame in interface com.jme3.post.SceneProcessor

cleanup

public void cleanup()
Specified by:
cleanup in interface com.jme3.post.SceneProcessor

getCamera

public com.jme3.renderer.Camera getCamera()
Getter for the camera.

Returns:
The camera of the offscreen scene

getMaterial

public com.jme3.material.Material getMaterial()
Getter for the material to render to.

Returns:
The material on which is rendered

getBackgroundColor

public com.jme3.math.ColorRGBA getBackgroundColor()
Getter for the background color of the scene.

Returns:
The color of the background

setBackgroundColor

public void setBackgroundColor(com.jme3.math.ColorRGBA backgroundColor)
Setter for the background color of the scene.

Parameters:
backgroundColor - The color of the background